import math

print sum(map(lambda x:int(math.sqrt(2*x))*(int(math.sqrt(2*x))+1)==2*x and 1 or 0 , [sum(ord(c)-ord('A')+1 for c in word.replace('"','')) for word in open('words.txt').read().split(',')]))
